package hb.software.login.service.impl;
import java.util.Iterator;
import javax.transaction.Transactional;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import hb.software.login.dao.LoginDao;
import hb.software.login.domain.Login;
import hb.software.login.service.LoginManager;
import hb.software.service.impl.GenericManagerImpl;

/** 
 * @ClassName: LoginManagerImpl 
 * @Description: TODO
 * @author WuYinjie
 * @date May 29, 2020 1:41:10 PM 
 *  
 */
@Service("loginManager")
@Transactional
public class LoginManagerImpl extends GenericManagerImpl<Login, Long> implements LoginManager{
    LoginDao loginDao;
    @Autowired
    public void setLoginDao(LoginDao loginDao) {
    	this.loginDao = loginDao;
    	this.dao=this.loginDao;
    }
    public Login login (Login user) {
    	Iterator<Login> iter = loginDao.findAll().iterator();
		 while(iter.hasNext()) {
			 Login string =  iter.next();
	            if(user.getName().equals(string.getName())) {
	            	return user;
	            }
		 }
		 return null;
    }
    
}
